package com.javacon;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class loginlogoutrequest
{
	public boolean isLoged = false;
	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args) 
	{
		
		try{
		
			new loginlogoutrequest().menu();
		}catch(Exception ex)
		{
			ex.printStackTrace();
		}
		
	}
	
	public static int read()
	{
		try{
		return Integer.parseInt(br.readLine());
		}
		catch(Exception ex)
		{ex.printStackTrace();}
		return -1;
	}
	
	public void menu()
	{
		boolean run = true;
		while (run)
		{
			System.out.println();
			System.out.println("-------MAIN MENU-----");
			System.out.println("1. login");
			System.out.println("2. logout");
			System.out.println("3. request");
			System.out.println();
			switch(read())
			{
			case 1:login();break;
			case 2:logout();break;
			case 3:request();break;
			default:break;
			}
		}
	}
	public void login()
	{
		isLoged = true;
		System.out.println();
		System.out.println("*");
		System.out.println("**");
		System.out.println("***");
		System.out.println("login called\n");
		System.out.println("***");
		System.out.println("**");
		System.out.println("*");
		System.out.println();
	}
	public void logout()
	{
		isLoged = false;
		System.out.println();
		System.out.println("*");
		System.out.println("**");
		System.out.println("***");
		System.out.println("logout called\n");
		System.out.println("***");
		System.out.println("**");
		System.out.println("*");
		System.out.println();
	}
	public void request()
	{
		System.out.println();
		System.out.println("*");
		System.out.println("**");
		System.out.println("***");
		System.out.println("request called");
		System.out.println("***");
		System.out.println("**");
		System.out.println("*");
		System.out.println();
		if(isLoged==false)
		{
			System.out.println("#########################################");
			System.out.println("Exception: BAD Request, User not logedin ");
			System.out.println("#########################################");
		}
		
		
	}
	
}
